<include file="public@header" />
</head>
<body>
<div class="wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('Goods/index')}">商品信息</a></li>
		<li class="active"><a href="{:url('Goods/add')}">添加商品</a></li>
	</ul>
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Goods/addPost')}">
		<div class="form-group">
			<label for="image" class="col-sm-2 control-label"><span class="form-required">*</span>图像</label>
			<input id="photo-1" type="hidden" name="image" >
			<input id="photo-1-name" type="text" readonly disabled title="图片名称">
			<img id="photo-1-preview" style="width: 10%">
			<a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
		</div>
		<div class="form-group">
			<label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>商品名称</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="name" name="name">
			</div>
		</div>
		<div class="form-group">
			<label  class="col-sm-2 control-label"><span class="form-required">*</span>图册</label>
			<div class="col-md-6 col-sm-10">
				<div id="imagesContainer"></div>
				<div class="margin-top-10">
					<a class="btn btn-default" href="javascript:uploadMultiImage('图片上传','#imagesContainer','photos-item-wrapper');">选择图片</a>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label for="freight" class="col-sm-2 control-label"><span class="form-required">*</span>运费</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="freight" name="freight">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">商品状态</label>
			<div class="col-md-6 col-sm-10">
				<label class="radio-inline">
					<input type="radio" name="status" value="1" checked> 正常
				</label>
				<label class="radio-inline">
					<input type="radio" name="status" value="2"> 下架
				</label>
				<label class="radio-inline">
					<input type="radio" name="status" value="0"> 无货
				</label>
			</div>
		</div>
		<div class="form-group">
			<label for="class_id" class="col-sm-2 control-label"><span class="form-required">*</span>分类ID</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="class_id" name="gid">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" name="__token__" value="{:token()}" />
				<button type="submit" class="btn btn-primary js-ajax-submit">添加</button>
			</div>
		</div>
	</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/html" id="photos-item-wrapper">
	<div style="display: flex;align-items: center;border: 1px solid #ddd;padding: 5px;margin-top: 10px">
		<div><img id="photo-{id}-preview" src="{url}" class="img-thumbnail" style="width: 100px;height: 50px;"></div>
		<div style="margin-left: 10px;">{name}</div>
		<input id="photo-{id}" type="hidden" name="images[]" value="{filepath}">
	</div>
</script>
</body>
</html>